import type { RouteRecordRaw } from "vue-router";

import layout from "@/layout/index.vue";
// import EmptyLayout from "@/layout/EmptyLayout.vue";

const constantRoutes: Array<RouteRecordRaw> = [
  {
    path: "/home",
    component: layout,
    redirect: "/home/page",
    meta: {
      hidden: false,
    },
    children: [
      {
        path: "page",
        name: "homepage",
        component: () => import("@/views/homePage/index.vue"),
        meta: {
          title: "工作台",
          icon: "ep:menu",
        },
      },
    ],
  },
  {
    path: "/login",
    name: "login",
    component: () => import("@/views/login/index.vue"),
    meta: {
      hidden: true,
    },
  },
  {
    path: "/iframe",
    component: layout,
    meta: {
      hidden: true,
      iframe: true,
    },
    children: [
      {
        path: "link",
        component: () => import("@/views/iframe/index.vue"),
      },
    ],
  },
  {
    path: "/404",
    name: "404",
    component: () => import("@/views/404.vue"),
    meta: {
      hidden: true,
    },
  },
];

const asyncRoutes: Array<RouteRecordRaw> = [
  {
    path: "/",
    redirect: "/menu/member",
    meta: {
      hidden: true,
    },
  },
  {
    path: "/menu",
    name: "menu",
    redirect: "/menu/member",
    component: layout,
    meta: {
      title: "菜单管理",
      icon: "ep:menu",
    },
    children: [
      {
        path: "member",
        name: "member",
        component: () => import("@/views/member/index.vue"),
        meta: {
          title: "员工管理",
          icon: "ep:user",
        },
      },
      {
        path: "category",
        name: "category",
        component: () => import("@/views/category/index.vue"),
        meta: {
          title: "分类管理",
          icon: "ep:sort",
        },
      },
      {
        path: "food",
        name: "food",
        component: () => import("@/views/dish/index.vue"),
        meta: {
          title: "菜品管理",
          icon: "ep:food",
        },
      },
      {
        path: "combo",
        name: "combo",
        component: () => import("@/views/member/index.vue"),
        meta: {
          title: "套餐管理",
          icon: "ep:sunset",
        },
      },
      {
        path: "order",
        name: "order",
        component: () => import("@/views/member/index.vue"),
        meta: {
          title: "订单明细",
          icon: "ep:coordinate",
        },
      },
    ],
  },
  {
    path: "https://gitee.com/boss-zhijie/reggie-take-out",
    redirect: "noRedirect",
    name: "reggie-take-out",
    meta: {
      title: "项目地址",
      target: "_blank",
      icon: "ep:star",
    },
  },
  {
    path: "https://baidu.com",
    redirect: "noRedirect",
    name: "baidu",
    meta: {
      title: "百度搜索",
      target: "_iframe",
      icon: "ep:search",
    },
  },
  {
    path: "https://www.bilibili.com",
    redirect: "noRedirect",
    name: "bilibili",
    meta: {
      title: "哔哩哔哩",
      target: "_iframe",
      icon: "ep:video-play",
    },
  },
  {
    path: "/:pathMatch(.*)*",
    redirect: "/404",
    meta: {
      hidden: true,
    },
  },
];

export { constantRoutes, asyncRoutes };
